/**
 * 动态导入 Dynamic import
 */
// 新原始类型
BigInt 
console.log(2 ** 53) // 最大init 
console.log(Number.MAX_SAFE_INTEGER)
let bigInt = BigInt(9007199254740992)
console.log(1n === 1, bigInt + bigInt)


// Promise 扩展  all：数组. 一个失败 全失败
// Promise.allSettled()
Promise.all([
  Promise.resolve({
    code: 200,
    data:[1,2,3]
  }),
  Promise.reject({
    code: 500,
    data:[]
  }),
  Promise.resolve({
    code: 200,
    data:[3,2,1]
  })
]).then(res => {
  console.log(res, 'success')
}).catch(err=> {
  console.log(err, 'fail')
})

Promise.allSettled([
  Promise.resolve({
    code: 200,
    data:[1,2,3]
  }),
  Promise.reject({
    code: 500,
    data:[]
  }),
  Promise.resolve({
    code: 200,
    data:[3,2,1]
  })
]).then(res => {
  const data = res.filter(item => item.status === 'fulfilled')
  console.log(data)
}).catch(err=> {
  console.log(err, 'fail')
})